package com.gsafety.wellsfort.domain.dto.question;

import com.gsafety.wellsfort.common.enums.CustomerTypeEnum;
import com.gsafety.wellsfort.common.enums.QuestionTypeEnum;
import com.gsafety.wellsfort.domain.dto.PageQueryDTO;
import com.gsafety.wellsfort.domain.model.knowledge.AnswerOption;
import com.gsafety.wellsfort.domain.model.knowledge.Question;
import com.gsafety.wellsfort.domain.vo.QueryVO;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotEmpty;
import java.util.List;

@Data
public class QuestionQueryDTO extends PageQueryDTO {

    @ApiModelProperty(value = "试题对象")
    @NotEmpty
    private Integer objectType;

    @ApiModelProperty(value = "关键字")
    private String keyword;

    @ApiModelProperty(value = "题目类型")
    private Integer questionType;

    @ApiModelProperty(value = "题目文字")
    private String questionTitle;

    @ApiModelProperty(value = "资源范围")
    private Integer resourceScope;

    @ApiModelProperty(value = "创建ID,前端不需要传题")
    private Integer creator;


    public static  class POBuilder{
        Question q =new Question();
        QuestionQueryDTO qVo;
        public POBuilder(QuestionQueryDTO qVo){
            this.qVo=qVo;
        }
        public Question build(){
            BeanUtils.copyProperties(qVo,q);
            q.setExamType(qVo.questionType);
            q.setTitle(qVo.questionTitle);
            return q;
        }
    }
    public static  class VOBuilder{
        Question q ;
        QuestionQueryDTO qVo=new QuestionQueryDTO();
        public VOBuilder(Question q){
            this.q=q;
        }
        public QuestionQueryDTO build(){
            BeanUtils.copyProperties(q,qVo);
            qVo.setQuestionType(q.getExamType());
            qVo.setQuestionTitle(q.getTitle());
            return qVo;
        }
    }
}
